﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SharingCenter.Web.Classes;

namespace SharingCenter.Web.Admin.Events
{
    public partial class Search : System.Web.UI.Page
    {
        protected void Page_Init(object sender, EventArgs e)
        {
            btnSearch.Click += new EventHandler(btnSearch_Click);
        }

        void btnSearch_Click(object sender, EventArgs e)
        {
            string keyword = txtKeyword.Text.Trim();
            scDataContext cxt = new scDataContext();
            var q = from t in cxt.Sc_Events
                    where t.Title.Contains(keyword)
                    orderby t.StartDate
                    select t;

            ListView1.DataSource = q;
            ListView1.DataBind();

            pnResult.Visible = true;
        }
    }
}